/**
 * 训练工具相关接口类型定义
 */

import { BaseApiResponse } from "./interface";


// 训练工具基本信息
export interface TrainingToolInfo {
  id: string;
  name: string;              // 工具名称
  identifier: string;        // 工具标识符
  description?: string;      // 工具描述
  icon?: string;            // 工具图标
  version?: string;         // 版本号
  category?: string;        // 分类
  type?: string;           // 类型
  difficulty: number;       // 难度等级 1-5
  status: number;          // 状态：0-禁用，1-启用
  sort?: number;           // 排序
  tags?: string[];         // 标签
  isRecommended?: boolean; // 是否推荐
  viewCount?: number;      // 查看次数
  useCount?: number;       // 使用次数
  rating?: number;         // 评分 0-5
  createTime: Date;
  updateTime?: Date;
}

// 训练工具详细信息
export interface TrainingToolDetailInfo extends TrainingToolInfo {
  config?: {
    // 工具配置信息
    levels?: {
      level: number;
      name: string;
      requiredScore: number;
      description?: string;
    }[];
    scoring?: {
      dailyScoreLimit?: number;
      maxScore?: number;
      minScore?: number;
      scoreRules?: any[];
    };
    features?: string[];
    requirements?: string[];
    instructions?: string;
  };
  trainingContent?: {
    id: string;
    name: string;
    description?: string;
  };
  trainingType?: {
    id: string;
    name: string;
    description?: string;
  };
  userStats?: {
    totalScore?: number;
    currentLevel?: number;
    currentLevelName?: string;
    maxLevel?: number;
    todayScore?: number;
    lastUsedTime?: Date;
  };
}

// 训练工具列表响应
export interface TrainingToolListResponse {
  tools: TrainingToolInfo[];
  total: number;
  page: number;
  size: number;
}

export interface TrainingToolListApiResponse extends BaseApiResponse<TrainingToolListResponse> {}

// 训练工具详情响应
export interface TrainingToolDetailApiResponse extends BaseApiResponse<TrainingToolDetailInfo> {}

// 训练工具信息响应（单个工具）
export interface TrainingToolInfoApiResponse extends BaseApiResponse<TrainingToolDetailInfo> {}

// 训练类型信息
export interface TrainingTypeInfo {
  id: string;
  name: string;
  description?: string;
  category?: string;
  icon?: string;
  status: number;
  sort?: number;
  toolCount?: number; // 该类型下的工具数量
  createTime: Date;
  updateTime?: Date;
}

// 训练类型列表响应
export interface TrainingTypeListApiResponse extends BaseApiResponse<TrainingTypeInfo[]> {}

// 训练内容信息
export interface TrainingContentDetail {
  id: string;
  name: string;
  description?: string;
  position?: string;    // 训练位置
  icon?: string;
  status: number;
  sort?: number;
  toolCount?: number;   // 该内容下的工具数量
  createTime: Date;
  updateTime?: Date;
}

// 训练内容列表响应
export interface TrainingContentListApiResponse extends BaseApiResponse<TrainingContentDetail[]> {}

// 训练工具搜索结果
export interface TrainingToolSearchResult extends TrainingToolInfo {
  score?: number;        // 搜索匹配度
  matchFields?: string[]; // 匹配的字段
}

// 训练工具搜索响应
export interface TrainingToolSearchResponse {
  results: TrainingToolSearchResult[];
  total: number;
  page: number;
  size: number;
  searchTime: number;    // 搜索耗时（毫秒）
  suggestions?: string[]; // 搜索建议
}

export interface TrainingToolSearchApiResponse extends BaseApiResponse<TrainingToolSearchResponse> {}
